<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/basicTemplate.xhtml">
	<ui:define name="content">
		<h:inputHidden rendered="#{menuController.userRank != 0}" value="#{menuController.redirect()}"></h:inputHidden>
		<h:inputHidden value="#{menuController.setUrl(request.requestURL)}"></h:inputHidden>
	    <h:inputHidden id="formMare" rendered="#{menuController.userRank == 0}">
		    <h:panelGrid columns="2" border="1">
				<h:column>
					<h:form>
						<h:panelGrid columns="2" width="100%" styleClass="inner-table"
							inlinestyle="word-break:break-all">
							<h:outputText value="Name:" />
							<h:inputText id="nameEmployee" value="${employeeDTO.name}" styleClass="inputText" />
							<h:outputText value="Email:" />
							<h:inputText id="emailEmployee" value="${employeeDTO.email}" styleClass="inputText" />
							
							<h:commandButton id="addEmployee"
								actionListener="#{adminController.addAdmin}" value="Add admin"
								styleClass="button">
								<f:ajax execute="nameEmployee emailEmployee"
									render=":mess :formm:table nameEmployee emailEmployee"></f:ajax>
							</h:commandButton>
						</h:panelGrid>
					</h:form>
					<br />
					<h:form id="formm">
						<h:panelGrid columns="1" width="100%" styleClass="inner-table">
							<h:dataTable id="table" value="#{adminController.listOfAdmins}"
								var="item" border="10" width="100%">
								<h:column>
									<f:facet name="header">
										<h:outputText value="Administrator" />
									</f:facet>
									<div align="center"><h:commandLink value="#{item.name}" disabled="true" ></h:commandLink></div>
								</h:column>
								<h:column>
									<f:facet name="header">
										<h:outputText value="Delete" />
									</f:facet>
									<div align="center"><h:selectManyCheckbox
										value="#{adminController.checkbox}" styleClass="inner-table">
										<f:selectItem itemLabel="Delete" itemValue="#{item.id}" />
									</h:selectManyCheckbox></div>
								</h:column>
							</h:dataTable>
							<h:panelGrid columns="2" width="auto" styleClass="inner-table">
								<h:commandButton id="deleteAdmins"
									actionListener="#{adminController.deleteAdmins}"
									value="Delete admins" styleClass="button"
									onclick="if (!confirm('Are you sure you want to continue?')) return false;">
								</h:commandButton>
							</h:panelGrid>
	
						</h:panelGrid>
					</h:form>
				</h:column>
			</h:panelGrid>
			<h:messages id="mess" styleClass="errorMessage"></h:messages>
		</h:inputHidden>
	</ui:define>
</ui:composition>
</html>